<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="div">
        <input type="checkbox"  value="banana">banana
        <input type="checkbox"  value="apple">apple
        <input type="checkbox"  value="orange">orange
        
    </div>
    <p></p>
    <input  id="baidu" type="text">
    <script>
       var input = document.getElementsByTagName('input');
       console.log(input);
    var len = input.length;
    var p = document.querySelector('p');
    div.onchange = function () {
        const arr =[]
        for (var i = 0; i < len; i++) {
            if (input[i].checked == true) {
                arr[i]=input[i].value
            }
        }
        p.innerText='你选择的是'+arr
    }   
    var baidu = document.getElementById('baidu')
    baidu.onfocus = function () {
       
    }
        
        
    </script>
</body>
</html>